package com.example.purplestarcb.shoujizhushou;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.TextView;


public class LostFindActivity extends ActionBarActivity {
    private SharedPreferences sp;
    private TextView textView;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //判断是否做过设置向导

        sp = getSharedPreferences("config", MODE_PRIVATE);
        boolean configed= sp.getBoolean("configed",false);

        if(configed){
            setContentView(R.layout.activity_lost_find);
            textView= (TextView) findViewById(R.id.lost_find_phone);
            String phoneNumber=sp.getString("safenumber","");
            textView.setText(phoneNumber);
        }else{
            //跳转向导界面
            Intent intent=new Intent(this,Setup1Activity.class);
            startActivity(intent);
            finish();
        }

    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.menu_lost_find, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();

        //noinspection SimplifiableIfStatement
        if (id == R.id.action_settings) {
            return true;
        }

        return super.onOptionsItemSelected(item);
    }
    //重新进入设置向导
    public void reEnter(View view){
        Intent intent=new Intent(LostFindActivity.this,Setup1Activity.class);
        startActivity(intent);
        finish();
    }
}
